#!/bin/bash
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$DIR/..
source $DIR/environment

if [ $# -lt 1 ]
  then
    echo "You should provide at least 1 args: path"
    exit 1
fi

PACKAGE_PATH=$1

$DIR/check
if [ $? -eq 0 ]; then
    docker-compose run --rm --name=polyaxon_lint -w /polyaxon/${PACKAGE_PATH} api /bin/bash -c "isort -rc . && black ."
fi
